﻿<?php

$shirts = array();

$cart = $_SESSION['cart'];
foreach($cart as $a)
{
	$art = unserialize($a);
	$s = ShirtQuery::create()->findPk($art->shirtId);
	$d = DisponibiliteQuery::create()->filterByShirtId( $art->shirtId)->filterByCouleur($art->color)->filterBySexe($art->sex)->filterByTaille($art->size)->findOne();
	$dispo = $stock = ($d->getQuantite()>0)?"En stock":"Rupture";
	array_push($shirts, array("id" => $art->shirtId, "brand" => $s->getMarque(), "description" => $s->getDescription(), "dispo" => $dispo, "price" => $s->getPrix(), "ref" => $art->shirtId, 
		"color" => $art->color, "sex" => $art->sex, "size" => $art->size, "quantity" => $art->quantity));
}

$smarty->assign("shirts", $shirts);
$smarty->display('cart.tpl');